package tum0r.model;

import javafx.beans.property.SimpleStringProperty;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

/**
 * 工程: ResourcesDatabase<br>
 * 包: tum0r.model<br>
 * 创建者: tum0r<br>
 * 创建时间: 2020/10/4 21:21<br>
 * <br>
 */
public class ResourceTableModel {
    private final SimpleStringProperty ID;
    private final SimpleStringProperty Name;
    private final SimpleStringProperty Type;
    private final SimpleStringProperty Label;
    private final SimpleStringProperty CreateTime;
    private final SimpleStringProperty LastAccessTime;
    private final SimpleStringProperty Size;

    public ResourceTableModel(Resource resource) {
        ID = new SimpleStringProperty(resource.ID);
        Name = new SimpleStringProperty(resource.Name);
        Type = new SimpleStringProperty(resource.Type);
        Label = new SimpleStringProperty(resource.Label);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        CreateTime = new SimpleStringProperty(dateFormat.format(resource.CreateTime));
        LastAccessTime = new SimpleStringProperty(dateFormat.format(resource.LastAccessTime));
        Size = new SimpleStringProperty(resource.sizeConvert);
    }

    public String getID() {
        return ID.get();
    }

    public SimpleStringProperty IDProperty() {
        return ID;
    }

    public void setID(String ID) {
        this.ID.set(ID);
    }

    public String getName() {
        return Name.get();
    }

    public SimpleStringProperty nameProperty() {
        return Name;
    }

    public void setName(String name) {
        this.Name.set(name);
    }

    public String getType() {
        return Type.get();
    }

    public SimpleStringProperty typeProperty() {
        return Type;
    }

    public void setType(String type) {
        this.Type.set(type);
    }

    public String getLabel() {
        return Label.get();
    }

    public SimpleStringProperty labelProperty() {
        return Label;
    }

    public void setLabel(String label) {
        this.Label.set(label);
    }

    public String getCreateTime() {
        return CreateTime.get();
    }

    public SimpleStringProperty createTimeProperty() {
        return CreateTime;
    }

    public void setCreateTime(String createTime) {
        this.CreateTime.set(createTime);
    }

    public String getLastAccessTime() {
        return LastAccessTime.get();
    }

    public SimpleStringProperty lastAccessTimeProperty() {
        return LastAccessTime;
    }

    public void setLastAccessTime(String lastAccessTime) {
        this.LastAccessTime.set(lastAccessTime);
    }

    public String getSize() {
        return Size.get();
    }

    public SimpleStringProperty sizeProperty() {
        return Size;
    }

    public void setSize(String size) {
        this.Size.set(size);
    }
}
